fix(transcript): fold mid-turn task notifications into the current turn on cold rebuild - #3102
Conversation
commit: |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 71c345b4c4
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
🦋 Changeset detectedLatest commit: 9d7120f The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 30a206bd4d
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ae00fdd883
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 709ca5b0d3
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 18330dae81
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b906a560da
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1ca99dae34
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a211b70fe2
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 85caf6d59f
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
74bb90e to
bc9a862
Compare
…rn on cold rebuild
…ndaries, not the previous message role
…ack when the wire has no turn.started records
…reserve legacy background_task turns absent from the boundary set
…-block tag, not just the tag lines
…truncate only at output blocks
…step, cold and live
bc9a862 to
11f9cd0
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2f795ccac7
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
…prompt content on accepted, normalize queued content - transcriptTaskSchema declares model/thinkingEffort: Zod strips undeclared keys, so schema-driven REST/WS consumers lost both fields the projector now populates. - PromptAccepted carries the admitted content (it is the only event a first-turn prompt ever emits, and the bare id left the prompts entity permanently partial) — projected with userMessageId and the public content shape via projectPromptContentParts, same as queued and the live backfill. - Regenerate the wire manifest and re-record the affected event-stream snapshots.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b72f0fba5f
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
…cepted prompt details across queueing - onTaskLifecycle carried resultSummary/usage/error/stateReason but dropped model/thinkingEffort: a completed detached-Agent row lost the metadata spawned set while running. - prompt.queued rebuilt the entity from scratch, discarding the userMessageId and createdAt that prompt.accepted had just stamped — build the queued update from prev.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6c0cc98134
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
The observable marker made the broadcaster forward every accepted prompt to v1 WS clients, but events-zod has no accepted variant (v1 surfaces submission through the service-synthesized prompt.submitted) and the SDK mapper didn't drop it — schema-driven clients could reject the frame. Drop it at the WS edge and in the SDK's dropped set; the transcript projection keeps consuming it internally.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fc52080934
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 71a941a7ab
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9721d36d91
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1e123e5192
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
… in folded notifications
|
@codex review |
|
Codex Review: Didn't find any major issues. More of your lovely PRs please. Reviewed commit: ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
…rn on cold rebuild (MoonshotAI#3102) * fix(transcript): fold mid-turn task notifications into the current turn on cold rebuild * chore: changeset for the notification fold fix * fix(transcript): key the notification fold on persisted task-turn boundaries, not the previous message role * fix(transcript): collect background_task turn origins too, and fall back when the wire has no turn.started records * fix(transcript): fold consecutive task notifications into the same turn * fix(transcript): normalize folded notification text to the live title/body form * fix(transcript): stop folded notification text before child blocks, preserve legacy background_task turns absent from the boundary set * fix(transcript): truncate folded notification text at the first child-block tag, not just the tag lines * fix(transcript): drop folded notifications without a persisted step, truncate only at output blocks * fix(transcript): attach mid-turn task notifications to the following step, cold and live * fix(transcript): keep other tasks' notifications in task-origin turns * fix(transcript): derive task-turn boundaries from durable turn.prompt records * feat(transcript): carry subagent model and thinking effort on task entities * fix(transcript): mirror turn liveness into meta.activity, live and cold * fix(transcript): populate the prompts entity from prompt.accepted/queued engine events * fix(transcript): reconcile liveness and the prompt queue at backfill from the live loop state * fix(transcript): include the prompts entity in the REST transcript response * fix(agent-core-v2): publish prompt.accepted on the event bus * test(transcript): add the contract-level e2e covering every entity the client renders from * fix(transcript): guard the prompt backfill against missing services; align stream expectations with prompt.accepted on the bus * test(agent-core-v2): re-record event stream snapshots with prompt.accepted published * fix(transcript): settle the spawned agent row when its lifecycle redirects to the task row * test(transcript): move the contract e2e timeout to the describe arg (jest lint) * fix(transcript): declare task model fields in the wire schema, carry prompt content on accepted, normalize queued content - transcriptTaskSchema declares model/thinkingEffort: Zod strips undeclared keys, so schema-driven REST/WS consumers lost both fields the projector now populates. - PromptAccepted carries the admitted content (it is the only event a first-turn prompt ever emits, and the bare id left the prompts entity permanently partial) — projected with userMessageId and the public content shape via projectPromptContentParts, same as queued and the live backfill. - Regenerate the wire manifest and re-record the affected event-stream snapshots. * fix(transcript): preserve task model fields across termination and accepted prompt details across queueing - onTaskLifecycle carried resultSummary/usage/error/stateReason but dropped model/thinkingEffort: a completed detached-Agent row lost the metadata spawned set while running. - prompt.queued rebuilt the entity from scratch, discarding the userMessageId and createdAt that prompt.accepted had just stamped — build the queued update from prev. * fix(transcript): keep prompt.accepted out of the public v1 event stream The observable marker made the broadcaster forward every accepted prompt to v1 WS clients, but events-zod has no accepted variant (v1 surfaces submission through the service-synthesized prompt.submitted) and the SDK mapper didn't drop it — schema-driven clients could reject the frame. Drop it at the WS edge and in the SDK's dropped set; the transcript projection keeps consuming it internally. * fix(transcript): derive cold task-turn boundaries through undo anchor replays * fix(transcript): flush trailing folded notifications into the open turn * fix(transcript): drop trailing buffered notifications to match the live projector * chore: split transcript changesets per logical change * fix(transcript): parse only the generated Title/Severity header lines in folded notifications
Found by the main-flow shadow reconciliation (kimi-code-app#279): a background-task completion notice that arrives mid-turn is persisted as a task-origin user message, and the cold rebuild (
groupMessagesIntoSnapshot) opened a NEW turn for each one — splitting the logical turn and reordering user/assistant chat turns, while the live projector folds them into the open step as role:'user' text frames.Now the cold path matches the live path: a task/background_task/task_notification user message whose previous message is assistant/tool output folds into the current turn as a taskId-keyed user text frame; otherwise (idle — the engine really does open a task turn) it keeps opening its own turn, preserving the legacy behavior locked by the existing test.
Tests: new cold-path case (notification between assistant messages folds in, one turn, taskId kept) + the existing legacy-behavior case both green; transcript package 79 green, typecheck/lint/no-comments clean.